﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using ThanhTu.GNCMedia.KQXS.DataAccess.DAL;


namespace WebUI.Admin
{
    public partial class Login : System.Web.UI.Page
    {
      

        #region Method
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        //private bool CheckUser()
        //{
        //    bool checkuser = false;
        //    conn = new OracleConnection(connStr);
        //    Orcmd = new OracleCommand("STORE_LOGIN", conn);
        //    Orcmd.CommandType = CommandType.StoredProcedure;
        //    Orcmd.Parameters.Add("@User", OracleType.VarChar);
        //    Orcmd.Parameters.Add("@Pasword", OracleType.VarChar);
        //    conn.Open();
        //    OracleDataReader reader = Orcmd.ExecuteReader();
        //    if (reader.Read())
        //    {
        //        checkuser = true;
        //    }
        //    else
        //    {
        //        checkuser = false;
        //    }


        //    return checkuser;
        //}

        #endregion

        protected void btn_loginAdmin_Click(object sender, EventArgs e)
        {
            UsersDAL user = new UsersDAL();
            int result = user.login(txt_User.Text, txt_passWord.Text);

            if (!txt_User.Text.Trim().Equals("") && !txt_passWord.Text.Trim().Equals("") && result>0)
            {
                Session.Add("UserName",Request["txt_User"]);
                Response.Redirect("Default.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "javascript:alert('Tên TÀI KHOẢN hoặc MẬT KHẨU không đúng,Xin vui lòng thử lại !  ');", true);
            }
        }
    }
}